import 'package:flutter/material.dart';
import 'package:flutter_advanced_drawer/flutter_advanced_drawer.dart';
import 'package:sj001/homePage.dart';
import 'package:sj001/pages/drawer/historyPage.dart';
import 'package:sj001/pages/login/loginPage.dart';

class DrawerHomePage extends StatefulWidget {
  const DrawerHomePage({Key? key}) : super(key: key);

  @override
  State<DrawerHomePage> createState() => _DrawerHomePageState();
}

class _DrawerHomePageState extends State<DrawerHomePage> {
  final advancedDrawerController = AdvancedDrawerController();
  void _handleMenuButtonPressed() {
    advancedDrawerController.showDrawer();
  }

  @override
  Widget build(BuildContext context) {
    return AdvancedDrawer(
      backdrop: Container(
        width: double.infinity,
        height: double.infinity,
        decoration: BoxDecoration(
          gradient: LinearGradient(
            begin: Alignment.topLeft,
            end: Alignment.bottomRight,
            colors: [Colors.blueGrey, Colors.blueGrey.withOpacity(0.2)],
          ),
        ),
      ),
      controller: advancedDrawerController,
      animationCurve: Curves.easeInOut,
      animationDuration: const Duration(milliseconds: 300),
      animateChildDecoration: true,
      rtlOpening: false,
      openScale: 0.95,
      disabledGestures: false,
      childDecoration: const BoxDecoration(
        borderRadius: const BorderRadius.all(Radius.circular(16)),
      ),
      drawer: SafeArea(
        child: HistoryPage(advancedDrawerController: advancedDrawerController,),
      ),
      child: MyHomePage(advancedDrawerController: advancedDrawerController),
    );
  }
}
